/********************************************/
// Creation History
// --------------------------------------------------------------
//	Company:			HTHK
//	NAME:				JdbcUtil.java
//  Title   :			
//	FUNCTION:
//	BY:					Teng Yang
//	DATE:				07/02/2013
// --------------------------------------------------------------
/*********************************************/
package com.util;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import org.apache.log4j.Logger;

public class JdbcUtil {
	private static Logger log = Logger.getLogger(JdbcUtil.class);
	public static void release(Connection con,Statement stmt,ResultSet rs){
		release(stmt,rs);
		if(con != null){
			try {
				con.close();
			} catch (SQLException e) {
				log.error("", e);
			}
		}
	}
	public static void release(Statement stmt,ResultSet rs){
		if(rs != null){
			try {
				rs.close();
			} catch (SQLException e) {
				log.error("", e);
			}
		}
		release(stmt);
	}
	public static void release(Statement stmt){
		if(stmt != null){
			try {
				stmt.close();
			} catch (SQLException e) {
				log.error("", e);
			}
		}
	}
	public static void rollback(Connection con){
		try {
			if(con != null){
				con.rollback(); 
			}
		} catch (SQLException e) {
			log.error("", e);
		}
	}
}
